package band.wukong.practice.springcloud.quickstart.qk08.client;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 使用Spring Cloud Bus实现通知微服务架构的配置文件的更新
 *
 * Spring Cloud Bus 将分布式的节点用轻量的消息代理连接起来。它可以用于广播配置文件的更改或者服务之间的通讯，也可以用于监控。
 *
 *
 * Server就不写了，用qk07的即可
 */
@RefreshScope
@RestController
@EnableEurekaClient
@SpringBootApplication
public class Qk08ConfigDistClientWithBusApplication {

    @Value("${foo}")
    private String foo;

    @RequestMapping(value = "/hi")
    public String hi() {
        return foo;
    }

    public static void main(String[] args) {
        SpringApplication.run(Qk08ConfigDistClientWithBusApplication.class, args);
    }

}
